<template>
  <el-container class="photo-group">
    <!-- 头部 -->
    <el-header class="photo-group-header">
      <!-- 资源来源 -->
      <photo-from @from-select="fromSelect" />
      <!-- 上传按钮组 -->
      <photo-upload v-bind="$attrs" :photo-group-id="photoGroupId" />
    </el-header>
    <el-container>
      <el-aside width="160px">
        <!-- 图片分类 -->
        <photo-category @group-select="groupSelect" />
      </el-aside>
      <el-main>
        <!-- 图片列表 -->
        <photo-main v-bind="$attrs" :photo-group-id="photoGroupId" :photo-from="photoFrom" />
      </el-main>
    </el-container>
    <!-- 底部 -->
    <el-footer>
      <photo-footer v-bind="$attrs" v-on="$listeners" />
    </el-footer>
  </el-container>
</template>

<script>
import PhotoCategory from './Category'
import PhotoFrom from './From'
import PhotoUpload from './Upload'
import PhotoMain from './Main'
import PhotoFooter from './Footer'

export default {
  name: 'PhotoGroup',
  components: { PhotoCategory, PhotoFrom, PhotoUpload, PhotoMain, PhotoFooter },
  data() {
    return {
      photoGroupId: null,
      photoFrom: null
    }
  },
  methods: {
    groupSelect(info) {
      this.photoGroupId = info.id
    },
    fromSelect(info) {
      this.photoFrom = info.from
    }
  },
}
</script>

<style lang="scss" scoped>
.photo-group {
  min-width: 700px;
  &-header {
    display: flex;
    border-bottom: solid 1px #e6e6e6;
  }
}
</style>